home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
ctutor.exe
/
ANSWERS
/
CH09_2.C
< prev
next >
Wrap
C/C++ Source or Header
|
1994-05-15
|
792b
|
38 lines
/* Chapter 9 - Program 2 - SINGLEIO.C */
#include <stdio.h>
#include <conio.h>
char storage[80];
void main()
{
char c;
int index = 0;
printf("Enter any characters, terminate program with X\n");
do {
c = _getch(); /* get a character */
if (index < 79) { /* limit it to 79 characters */
storage[index] = c;
index++;
}
putchar(c); /* display the hit key */
} while (c != 'X');
storage[index] = 0;
printf("%s\n", storage);
printf("\nEnd of program.\n");
}
/* Result of execution
Enter any characters, terminate program with X
(The output depends on the characters you type in.)
End of program.
*/